package com.ruoyi.transaction.Repository;


import com.ruoyi.common.entity.TransactionEntity.DTO.SpuSearchDTO;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * SPU搜索Repository
 */
@Repository
public interface SpuSearchRepository extends ElasticsearchRepository<SpuSearchDTO, Long> {

    /**
     * 根据商品名称模糊搜索
     */
    List<SpuSearchDTO> findByNameContaining(String name);

    /**
     * 根据品牌名称模糊搜索
     */
    List<SpuSearchDTO> findByBrandNameContaining(String brandName);

    /**
     * 根据分类名称模糊搜索
     */
    List<SpuSearchDTO> findByCategoryNameContaining(String categoryName);

    /**
     * 根据商品名称或品牌名称或分类名称搜索
     */
    List<SpuSearchDTO> findByNameContainingOrBrandNameContainingOrCategoryNameContaining(
            String name, String brandName, String categoryName);

    /**
     * 根据分类ID搜索
     */
    List<SpuSearchDTO> findByCategoryId(Long categoryId);

    /**
     * 根据是否激活状态搜索
     */
    List<SpuSearchDTO> findByIsActive(String isActive);

    /**
     * 根据删除标志搜索
     */
    List<SpuSearchDTO> findByDelFlag(String delFlag);
}